package com.bocaizp.operation.mapper;

import com.bocaizp.pojo.DTO.AnalysisHotDTO;
import com.bocaizp.pojo.DTO.AnalysisJobNumberDTO;
import com.bocaizp.pojo.DTO.UserStepDTO;
import com.bocaizp.pojo.DTO.UserValueDTO;
import com.bocaizp.pojo.VO.AnalysisNameValueVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Author : huang jie
 * Date : 2024/5/5 22:50
 **/
@Mapper
public interface DataAnalysisMapper {

	/**
	 * 获取所有用户
	 *
	 * @return
	 */
	@Select("select last_login_time,login_number,interview_number,create_time from user_test;")
	List<UserValueDTO> getAllUser();

	/**
	 * 查询全国岗位分布
	 * @return
	 */
	@Select("select name,value from analysis_country_job")
	List<AnalysisNameValueVO> getCountry();

	/**
	 * 所有岗位学历占比
	 * @return
	 */
	@Select("select name, value from analysis_degrees")
	List<AnalysisNameValueVO> getDegrees();

	/**
	 * 获取前七个行业平均薪资（以薪资排序）
	 * @return
	 */
	@Select("select industry as name,date_g as value from industry_hot_salary where status = #{status} order by value desc limit 0, 7")
	List<AnalysisNameValueVO> getAvgSalary(int status);

	/**
	 * 获取岗位总数数据
	 *
	 * @return
	 */
	@Select("select data_a, data_b, data_c, data_d, data_e, data_f, data_g, data_h, data_i from analysis_job_number")
	List<AnalysisJobNumberDTO> getJobNumber();

	/**
	 * 获取前十行业热度数据
	 *
	 * @return
	 */
	@Select("select industry as name, date_g as value from industry_hot_salary where status = #{status} order by date_g desc limit 0, 10")
	List<AnalysisNameValueVO> getDataHot(int status);

	/**
	 * 获取用户分层数据
	 * @return
	 */
	@Select("select value_a, value_b, value_c, value_d, value_e, value_f, value_g, value_h from user_forecast order by update_time")
	List<UserStepDTO> getUserData();

	/**
	 * 获取行业热度数据
	 *
	 * @param industry
	 * @param hot
	 * @return
	 */
	@Select("select date_a, date_b, date_c, date_d, date_e, date_f, date_g, fut_a, fut_b, fut_c, fut_d from industry_hot_salary where industry = #{industry} and status = #{hot}")
	AnalysisHotDTO getForecast(@Param("industry") String industry,@Param("hot") int hot);
}
